from qgis.core import *
import math

Head = '''

TITLE ""
--------

-- VISSIM 4.30-01

RANDOM_SEED         42
SIMULATION_DURATION  3600.0
SIMULATION_STARTTIME "00:00:00"
SIMULATION_SPEED MAX 10.0
TIME_STEP            5
UNIT             DISTANCE 1 0
UNIT             DISTANCE 2 0
UNIT             SPEED 0
UNIT             ACCELERATION 0
QUEUE SPEED UNDER 5.0  OVER 10.0 DX UNDER 20.0 LENGTH MAX 500.0
     FROM 0 UNTIL 99999  AGGREGATION_INTERVAL 99999


-- Multi-Run: --
----------------

MULTIRUN
     RANDOM_SEED            1
     RANDOM_SEED_INCREMENT  1
     NUMBER_RUNS            10
     DTA_INCREMENT          0.0
     EVAL_DIRECTORY "#data#"
 

-- Dynamic Assignment: --
-------------------------

DTA
     TRIP_CHAIN_FILE      0 ""
     MATRICES             0
     COST_FILE            "" NODE YES
     PATH_FILE            "" NODE YES
     COST_INTERVAL        600
     MAX_PATHNUMBER       -999
     STRATEGY             0
     ROUTE_GUIDANCE_OFFSET 999999 999999
     OFFSET               0 0
     KIRCHHOFF_EXPONENT   3.50  
     VOLUME     PERCENT   -1.00 
     PATHEVAL   PERCENT   -0.75 
     DETOURS              -2.50 
     LOGIT                1.50000
     UNDER 0.00100
     CONVERGENCE  
       PATHS        
       EDGE         
     MSA                  0     



-- Vehicle Types: --
--------------------

VEHICLE_TYPE  100
     NAME                  "Car"
     CATEGORY              CAR
     COLOR_DIST             1 
     LENGTH                4.760
     WIDTH                 1.500
     MASS                  1
     POWER                 1
     LAYER                 0
     ALLOWEDLOAD           0
     MODEL_YEAR            0
     MILEAGE               0
     LOAD                  0.0
     OCCUPANCY             0.0
     KATTEMPERATURE        0
     WATERTEMPERATURE      0
     MAX_ACCELERATION      1
     DESIRED_ACCELERATION  1
     MAX_DECELERATION      1
     DESIRED_DECELERATION  1
     EQUIPMENT             NONE
     DRIVER                UNIDENTIFIED
     PASSENGERS            1.0
     VEHICLE_MODEL_DIST   10
     COST_COEFFICIENTS 1.000 0.000 1.000
     FEE 0.000 0.000 0.000 0.000 
     ATTRACTION 0.000 0.000 0.000 0.000 
     DESTINATION 0.000 0.000 0.000 0.000 
     POSITION 0.000 0.000 0.000 0.000 
     PARKING_AVAILABILITY 0.000 0.000 0.000 0.000 
VEHICLE_TYPE  200
     NAME                  "HGV"
     CATEGORY              HGV
     COLOR_DIST             1 
     LENGTH                10.215
     WIDTH                 2.500
     MASS                  2
     POWER                 2
     LAYER                 0
     ALLOWEDLOAD           0
     MODEL_YEAR            0
     MILEAGE               0
     LOAD                  1.0
     OCCUPANCY             0.0
     KATTEMPERATURE        0
     WATERTEMPERATURE      0
     MAX_ACCELERATION      2
     DESIRED_ACCELERATION  2
     MAX_DECELERATION      2
     DESIRED_DECELERATION  2
     EQUIPMENT             NONE
     DRIVER                UNIDENTIFIED
     PASSENGERS            1.0
     VEHICLE_MODEL_DIST   20
     COST_COEFFICIENTS 1.000 0.000 1.000
     FEE 0.000 0.000 0.000 0.000 
     ATTRACTION 0.000 0.000 0.000 0.000 
     DESTINATION 0.000 0.000 0.000 0.000 
     POSITION 0.000 0.000 0.000 0.000 
     PARKING_AVAILABILITY 0.000 0.000 0.000 0.000 
VEHICLE_TYPE  300
     NAME                  "Bus"
     CATEGORY              BUS
     COLOR_DIST             1 
     LENGTH                11.541
     WIDTH                 2.500
     MASS                  3
     POWER                 3
     LAYER                 0
     ALLOWEDLOAD           0
     MODEL_YEAR            0
     MILEAGE               0
     LOAD                  0.0
     OCCUPANCY             0.0
     KATTEMPERATURE        0
     WATERTEMPERATURE      0
     MAX_ACCELERATION      3
     DESIRED_ACCELERATION  3
     MAX_DECELERATION      3
     DESIRED_DECELERATION  3
     EQUIPMENT             NONE
     DRIVER                UNIDENTIFIED
     PASSENGERS            1.0
     VEHICLE_MODEL_DIST   30
     ALIGHTING_TIME 0.00 BOARDING_TIME 0.00 ADDITION YES
     DELAY_TIME 0.00 CAPACITY 999
     COST_COEFFICIENTS 1.000 0.000 1.000
     FEE 0.000 0.000 0.000 0.000 
     ATTRACTION 0.000 0.000 0.000 0.000 
     DESTINATION 0.000 0.000 0.000 0.000 
     POSITION 0.000 0.000 0.000 0.000 
     PARKING_AVAILABILITY 0.000 0.000 0.000 0.000 
VEHICLE_TYPE  400
     NAME                  "Tram"
     CATEGORY              TRAM
     COLOR_DIST             1 
     LENGTH                15.698
     WIDTH                 2.500
     MASS                  4
     POWER                 4
     LAYER                 0
     ALLOWEDLOAD           0
     MODEL_YEAR            0
     MILEAGE               0
     LOAD                  0.0
     OCCUPANCY             0.0
     KATTEMPERATURE        0
     WATERTEMPERATURE      0
     MAX_ACCELERATION      4
     DESIRED_ACCELERATION  4
     MAX_DECELERATION      4
     DESIRED_DECELERATION  4
     EQUIPMENT             NONE
     DRIVER                UNIDENTIFIED
     PASSENGERS            1.0
     VEHICLE_MODEL_DIST   40
     ALIGHTING_TIME 0.00 BOARDING_TIME 0.00 ADDITION YES
     DELAY_TIME 0.00 CAPACITY 9999
     COST_COEFFICIENTS 1.000 0.000 1.000
     FEE 0.000 0.000 0.000 0.000 
     ATTRACTION 0.000 0.000 0.000 0.000 
     DESTINATION 0.000 0.000 0.000 0.000 
     POSITION 0.000 0.000 0.000 0.000 
     PARKING_AVAILABILITY 0.000 0.000 0.000 0.000 
VEHICLE_TYPE  500
     NAME                  "Pedestrian"
     CATEGORY              PEDESTRIAN
     COLOR_DIST             1 
     LENGTH                0.342
     WIDTH                 0.500
     MASS                  5
     POWER                 5
     LAYER                 0
     ALLOWEDLOAD           0
     MODEL_YEAR            0
     MILEAGE               0
     LOAD                  0.0
     OCCUPANCY             0.0
     KATTEMPERATURE        0
     WATERTEMPERATURE      0
     MAX_ACCELERATION      5
     DESIRED_ACCELERATION  5
     MAX_DECELERATION      5
     DESIRED_DECELERATION  5
     EQUIPMENT             NONE
     DRIVER                UNIDENTIFIED
     PASSENGERS            1.0
     VEHICLE_MODEL_DIST   50
     COST_COEFFICIENTS 1.000 0.000 1.000
     FEE 0.000 0.000 0.000 0.000 
     ATTRACTION 0.000 0.000 0.000 0.000 
     DESTINATION 0.000 0.000 0.000 0.000 
     POSITION 0.000 0.000 0.000 0.000 
     PARKING_AVAILABILITY 0.000 0.000 0.000 0.000 
VEHICLE_TYPE  600
     NAME                  "Bike"
     CATEGORY              BICYCLE
     COLOR_DIST             1 
     LENGTH                1.445
     WIDTH                 0.500
     MASS                  6
     POWER                 6
     LAYER                 0
     ALLOWEDLOAD           0
     MODEL_YEAR            0
     MILEAGE               0
     LOAD                  0.0
     OCCUPANCY             0.0
     KATTEMPERATURE        0
     WATERTEMPERATURE      0
     MAX_ACCELERATION      6
     DESIRED_ACCELERATION  6
     MAX_DECELERATION      6
     DESIRED_DECELERATION  6
     EQUIPMENT             NONE
     DRIVER                UNIDENTIFIED
     PASSENGERS            1.0
     VEHICLE_MODEL_DIST   60
     COST_COEFFICIENTS 1.000 0.000 1.000
     FEE 0.000 0.000 0.000 0.000 
     ATTRACTION 0.000 0.000 0.000 0.000 
     DESTINATION 0.000 0.000 0.000 0.000 
     POSITION 0.000 0.000 0.000 0.000 
     PARKING_AVAILABILITY 0.000 0.000 0.000 0.000 


-- Vehicle Classes: --
----------------------

 VEHICLE_CLASS  10
     NAME          "Car"
     COLOR         NONE
     VEHICLE_TYPES 100
 VEHICLE_CLASS  20
     NAME          "HGV"
     COLOR         NONE
     VEHICLE_TYPES 200
 VEHICLE_CLASS  30
     NAME          "Bus"
     COLOR         NONE
     VEHICLE_TYPES 300
 VEHICLE_CLASS  40
     NAME          "Tram"
     COLOR         NONE
     VEHICLE_TYPES 400
 VEHICLE_CLASS  50
     NAME          "Pedestrian"
     COLOR         NONE
     VEHICLE_TYPES 500
 VEHICLE_CLASS  60
     NAME          "Bike"
     COLOR         NONE
     VEHICLE_TYPES 600


-- Driving Behavior: --
-----------------------

DRIVING_BEHAVIOR 1 NAME "Urban (motorized)"
   LANE_CHANGE_BEHAVIOR FREE_LANESEL
      T_DISAPPEAR 60.00 MIN_LC_GAP 0.50 MIN_FREEFLOW 11.00
      MIN_ACCELERATION OWN MIN -4.00 DISTANCE 100.00 MAX -1.00
          TRAILING_VEHICLE MIN -3.00 DISTANCE 100.00 MAX -1.00
               COOPERATIVE -3.00   ABXFACTOR 0.60 
   CAR_FOLLOW_MODEL WIEDEMANN74
      NUMB_PRECED 2 OBS_DISTANCE MIN 0.00 MAX 250.00  
      AX_AVERAGE 2.00 BX_ADD 2.00 BX_MULT 3.00
      CC0 1.50  CC1 0.90  CC2 4.00  CC3 -8.00  CC4 -0.35
      CC5 0.35  CC6 11.44  CC7 0.25  CC8 3.50  CC9 1.50
   LATERAL_BEHAVIOR MIDDLE 
      OVERTAKE RIGHT  VEHICLE_CLASSES 
      OVERTAKE LEFT  VEHICLE_CLASSES 
      LAT_DISTANCE DEFAULT DY_STAND 1.00 DY_50KMH 1.00
   AMBER_BEHAVIOR CONT_CHECK
      AMBER_ALPHA 1.58858105 AMBER_BETA1 -0.26198070 AMBER_BETA2 0.26945295
DRIVING_BEHAVIOR 2 NAME "Right-side rule (motorized)"
   LANE_CHANGE_BEHAVIOR RIGHT_HAND_RULE
      T_DISAPPEAR 60.00 MIN_LC_GAP 0.50 MIN_FREEFLOW 11.00
      MIN_ACCELERATION OWN MIN -4.00 DISTANCE 200.00 MAX -1.00
          TRAILING_VEHICLE MIN -3.00 DISTANCE 200.00 MAX -0.50
               COOPERATIVE -3.00   ABXFACTOR 0.60 
   CAR_FOLLOW_MODEL WIEDEMANN99
      NUMB_PRECED 2 OBS_DISTANCE MIN 0.00 MAX 250.00  
      AX_AVERAGE 2.00 BX_ADD 2.00 BX_MULT 3.00
      CC0 1.50  CC1 0.90  CC2 4.00  CC3 -8.00  CC4 -0.35
      CC5 0.35  CC6 11.44  CC7 0.25  CC8 3.50  CC9 1.50
   LATERAL_BEHAVIOR MIDDLE 
      OVERTAKE RIGHT  VEHICLE_CLASSES 
      OVERTAKE LEFT  VEHICLE_CLASSES 
      LAT_DISTANCE DEFAULT DY_STAND 1.00 DY_50KMH 1.00
   AMBER_BEHAVIOR CONT_CHECK
      AMBER_ALPHA 1.58858105 AMBER_BETA1 -0.26198070 AMBER_BETA2 0.26945295
DRIVING_BEHAVIOR 3 NAME "Freeway (free lane selection)"
   LANE_CHANGE_BEHAVIOR FREE_LANESEL
      T_DISAPPEAR 60.00 MIN_LC_GAP 0.50 MIN_FREEFLOW 11.00
      MIN_ACCELERATION OWN MIN -4.00 DISTANCE 200.00 MAX -1.00
          TRAILING_VEHICLE MIN -3.00 DISTANCE 200.00 MAX -0.50
               COOPERATIVE -3.00   ABXFACTOR 0.60 
   CAR_FOLLOW_MODEL WIEDEMANN99
      NUMB_PRECED 2 OBS_DISTANCE MIN 0.00 MAX 250.00  
      AX_AVERAGE 2.00 BX_ADD 2.00 BX_MULT 3.00
      CC0 1.50  CC1 0.90  CC2 4.00  CC3 -8.00  CC4 -0.35
      CC5 0.35  CC6 11.44  CC7 0.25  CC8 3.50  CC9 1.50
   LATERAL_BEHAVIOR MIDDLE 
      OVERTAKE RIGHT  VEHICLE_CLASSES 
      OVERTAKE LEFT  VEHICLE_CLASSES 
      LAT_DISTANCE DEFAULT DY_STAND 1.00 DY_50KMH 1.00
   AMBER_BEHAVIOR CONT_CHECK
      AMBER_ALPHA 1.58858105 AMBER_BETA1 -0.26198070 AMBER_BETA2 0.26945295
DRIVING_BEHAVIOR 4 NAME "Footpath (no interaction)"
   LANE_CHANGE_BEHAVIOR FREE_LANESEL
      T_DISAPPEAR 60.00 MIN_LC_GAP 0.50 MIN_FREEFLOW 11.00
      MIN_ACCELERATION OWN MIN -4.00 DISTANCE 100.00 MAX -1.00
          TRAILING_VEHICLE MIN -3.00 DISTANCE 100.00 MAX -1.00
               COOPERATIVE -3.00   ABXFACTOR 0.60 
   CAR_FOLLOW_MODEL NO_INTERACTION
      NUMB_PRECED 2 OBS_DISTANCE MIN 0.00 MAX 250.00  
      AX_AVERAGE 2.00 BX_ADD 2.00 BX_MULT 3.00
      CC0 1.50  CC1 0.90  CC2 4.00  CC3 -8.00  CC4 -0.35
      CC5 0.35  CC6 11.44  CC7 0.25  CC8 3.50  CC9 1.50
   LATERAL_BEHAVIOR ANY 
      OVERTAKE RIGHT  VEHICLE_CLASSES 
      OVERTAKE LEFT  VEHICLE_CLASSES 
      LAT_DISTANCE DEFAULT DY_STAND 1.00 DY_50KMH 1.00
   AMBER_BEHAVIOR CONT_CHECK
      AMBER_ALPHA 1.58858105 AMBER_BETA1 -0.26198070 AMBER_BETA2 0.26945295
DRIVING_BEHAVIOR 5 NAME "Cycle-Track (free overtaking)"
   LANE_CHANGE_BEHAVIOR FREE_LANESEL
      T_DISAPPEAR 60.00 MIN_LC_GAP 0.50 MIN_FREEFLOW 11.00
      MIN_ACCELERATION OWN MIN -4.00 DISTANCE 100.00 MAX -1.00
          TRAILING_VEHICLE MIN -3.00 DISTANCE 100.00 MAX -1.00
               COOPERATIVE -3.00   ABXFACTOR 0.60 
   CAR_FOLLOW_MODEL WIEDEMANN99
      NUMB_PRECED 2 OBS_DISTANCE MIN 10.00 MAX 250.00  DIAMOND_SHAPE
      AX_AVERAGE 2.00 BX_ADD 2.00 BX_MULT 3.00
      CC0 0.50  CC1 0.50  CC2 0.00  CC3 -8.00  CC4 -0.35
      CC5 0.35  CC6 11.44  CC7 0.25  CC8 3.50  CC9 1.50
   LATERAL_BEHAVIOR RIGHT 
      OVERTAKE RIGHT  VEHICLE_CLASSES ALL
      OVERTAKE LEFT  VEHICLE_CLASSES ALL
      LAT_DISTANCE DEFAULT DY_STAND 0.10 DY_50KMH 0.30
   AMBER_BEHAVIOR CONT_CHECK
      AMBER_ALPHA 1.58858105 AMBER_BETA1 -0.26198070 AMBER_BETA2 0.26945295


-- Link Types: --
-----------------

LINKTYPE 1 NAME "Urban (motorized)" COLOR GRAY
   DEFAULT DRIVING_BEHAVIOR 1
LINKTYPE 2 NAME "Right-side rule (motorized)" COLOR GRAY
   DEFAULT DRIVING_BEHAVIOR 2
LINKTYPE 3 NAME "Freeway (free lane selection)" COLOR GRAY
   DEFAULT DRIVING_BEHAVIOR 3
LINKTYPE 4 NAME "Footpath (no interaction)" COLOR GRAY
   DEFAULT DRIVING_BEHAVIOR 4
LINKTYPE 5 NAME "Cycle-Track (free overtaking)" COLOR GRAY
   DEFAULT DRIVING_BEHAVIOR 5
'''

End = '''

-- Connectors: --
-----------------



-- Direction Decisions: --
--------------------------


-- Routing Decisions: --
------------------------


-- Desired Speed Decisions: --
------------------------------


-- Reduced Speed Areas: --
--------------------------


-- Inputs: --
-------------


-- Traffic Compositions: --
---------------------------

COMPOSITION     1 NAME "Default"
     KATTEMPERATURE 1
     WATERTEMPERATURE 2
     VEHICLE_TYPE 100 FRACTION 0.980 DESIRED_SPEED 50
     VEHICLE_TYPE 200 FRACTION 0.020 DESIRED_SPEED 50


-- Distributions: --
--------------------

DESIRED_SPEED 140  80.00 0.000  99.00 0.030  109.00 0.100  121.00 0.260  131.00 0.470  149.00 0.800  165.00 0.930  185.00 0.990  205.00 1.000
DESIRED_SPEED 130  80.00 0.000  98.00 0.030  110.00 0.100  130.00 0.680  135.00 0.720  143.00 0.910  155.00 0.970  170.00 1.000
DESIRED_SPEED 120  85.00 0.000  105.00 0.030  110.00 0.100  125.00 0.680  140.00 0.910  155.00 1.000
DESIRED_SPEED 100  88.00 0.000  95.00 0.030  100.00 0.100  110.00 0.700  120.00 0.910  130.00 1.000
DESIRED_SPEED 90  85.00 0.000  90.00 0.050  100.00 0.800  110.00 0.950  120.00 1.000
DESIRED_SPEED 85  84.00 0.000  88.00 1.000
DESIRED_SPEED 80  75.00 0.000  80.00 0.050  90.00 0.800  100.00 0.950  110.00 1.000
DESIRED_SPEED 70  68.00 0.000  78.00 1.000
DESIRED_SPEED 60  58.00 0.000  68.00 1.000
DESIRED_SPEED 50  48.00 0.000  58.00 1.000
DESIRED_SPEED 40  40.00 0.000  45.00 1.000
DESIRED_SPEED 30  30.00 0.000  35.00 1.000
DESIRED_SPEED 25  25.00 0.000  30.00 1.000
DESIRED_SPEED 20  20.00 0.000  25.00 1.000
DESIRED_SPEED 15  15.00 0.000  20.00 1.000
DESIRED_SPEED 12  12.00 0.000  15.00 1.000
DESIRED_SPEED  5   4.00 0.000   6.00 1.000
MODEL_YEARS  1  1990.00 0.000  2003.00 1.000
MILEAGE  1   0.00 0.000  200000.00 1.000
MASSES  6  40.00 0.000  130.00 1.000
MASSES  5  30.00 0.000  120.00 1.000
MASSES  4  23000.00 0.000  58000.00 1.000
MASSES  3  4000.00 0.000  12000.00 1.000
MASSES  2  2800.00 0.000  40000.00 1.000
MASSES  1  800.00 0.000  2000.00 1.000
POWER  6   0.50 0.000   0.70 1.000
POWER  5   0.50 0.000   0.70 1.000
POWER  4  300.00 0.000  600.00 1.000
POWER  3  150.00 0.000  300.00 1.000
POWER  2  150.00 0.000  400.00 1.000
POWER  1  55.00 0.000  160.00 1.000
TEMPERATURE  2   0.00 0.000  100.00 1.000
TEMPERATURE  1   0.00 0.000  400.00 1.000
TIMES  1   MEAN 20.0  STANDARD_DEVIATION  2.0


-- Color Distributions: --
--------------------------

COLOR_DIST  1 NAME "Default"
   FRACTION  1.000 COLOR   0   0   0
   FRACTION  1.000 COLOR 255   0   0
   FRACTION  1.000 COLOR 255 255 255
   FRACTION  1.000 COLOR   0   0 185
   FRACTION  1.000 COLOR 209 209 209
   FRACTION  0.500 COLOR  95  95  95
   FRACTION  0.250 COLOR   0 128   0
   FRACTION  0.250 COLOR   0 128 255
   FRACTION  0.100 COLOR 255 255   0
   FRACTION  0.100 COLOR 255 128   0


-- Vehicle Model Distributions: --
----------------------------------

VEHICLE_MODEL_DIST  60 NAME "Bike"
   FRACTION  0.100 
     FILE "#3dmodels#vehicles\bike.v3d"  LENGTH  1.445 AXLE FRONT  0.232  AXLE REAR  1.097  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  1.408

VEHICLE_MODEL_DIST  50 NAME "Pedestrian"
   FRACTION  0.100 
     FILE "#3dmodels#vehicles\man.v3d"  LENGTH  0.342 AXLE FRONT  0.016  AXLE REAR  0.054  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  0.342

VEHICLE_MODEL_DIST  40 NAME "Tram"
   FRACTION  0.100 
     FILE "#3dmodels#vehicles\tram.v3d"  LENGTH 15.698 AXLE FRONT  3.385  AXLE REAR 12.346  SHAFT  1.224  CLUTCH FRONT  0.144  CLUTCH REAR 15.819

VEHICLE_MODEL_DIST  30 NAME "Bus"
   FRACTION  0.100 
     FILE "#3dmodels#vehicles\bus.v3d"  LENGTH 11.541 AXLE FRONT  2.567  AXLE REAR  8.446  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR 11.262

VEHICLE_MODEL_DIST  20 NAME "HGV"
   FRACTION  0.100 
     FILE "#3dmodels#vehicles\truck.v3d"  LENGTH 10.215 AXLE FRONT  1.559  AXLE REAR  7.333  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  9.940

VEHICLE_MODEL_DIST  10 NAME "Car"
   FRACTION  0.260 
     FILE "#3dmodels#vehicles\car1.v3d"  LENGTH  4.110 AXLE FRONT  0.850  AXLE REAR  3.336  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  4.026
   FRACTION  0.180 
     FILE "#3dmodels#vehicles\car2.v3d"  LENGTH  4.550 AXLE FRONT  0.808  AXLE REAR  3.494  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  4.550
   FRACTION  0.180 
     FILE "#3dmodels#vehicles\car3.v3d"  LENGTH  4.610 AXLE FRONT  0.935  AXLE REAR  3.695  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  4.600
   FRACTION  0.180 
     FILE "#3dmodels#vehicles\car4.v3d"  LENGTH  4.760 AXLE FRONT  0.910  AXLE REAR  3.695  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  4.713
   FRACTION  0.160 
     FILE "#3dmodels#vehicles\car5.v3d"  LENGTH  4.400 AXLE FRONT  0.800  AXLE REAR  3.298  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  4.400
   FRACTION  0.020 
     FILE "#3dmodels#vehicles\car6.v3d"  LENGTH  4.340 AXLE FRONT  0.873  AXLE REAR  3.212  SHAFT  0.000  CLUTCH FRONT  0.000  CLUTCH REAR  4.340


-- Functions: --
----------------

MAX_ACCELERATION  6 NAME "Bike"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 3.500 1.960 3.500  10.000 3.200 1.493 3.500  20.000 2.786 1.300 3.500  30.000 2.468 1.152 3.500  40.000 2.200 1.027 3.500  50.000 1.964 0.917 3.273  60.000 1.751 0.817 2.918  70.000 1.554 0.725 2.590  80.000 1.372 0.640 2.286  90.000 1.200 0.560 2.000  100.000 1.038 0.484 1.730  110.000 0.969 0.452 1.614  120.000 0.899 0.420 1.499  130.000 0.830 0.387 1.384  140.000 0.761 0.355 1.268  150.000 0.692 0.323 1.153  160.000 0.623 0.291 1.038  170.000 0.553 0.258 0.922  180.000 0.484 0.226 0.807  190.000 0.415 0.194 0.692  200.000 0.346 0.161 0.577  210.000 0.277 0.129 0.461  220.000 0.208 0.097 0.346  230.000 0.138 0.065 0.231  240.000 0.069 0.032 0.115  250.000 0.000 0.000 0.000
MAX_ACCELERATION  5 NAME "Pedestrian"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 3.000 3.000 3.000  10.000 3.000 3.000 3.000  20.000 0.000 0.000 0.000  30.000 0.000 0.000 0.000  40.000 0.000 0.000 0.000  50.000 0.000 0.000 0.000  60.000 0.000 0.000 0.000  70.000 0.000 0.000 0.000  80.000 0.000 0.000 0.000  90.000 0.000 0.000 0.000  100.000 0.000 0.000 0.000  110.000 0.000 0.000 0.000  120.000 0.000 0.000 0.000  130.000 0.000 0.000 0.000  140.000 0.000 0.000 0.000  150.000 0.000 0.000 0.000  160.000 0.000 0.000 0.000  170.000 0.000 0.000 0.000  180.000 0.000 0.000 0.000  190.000 0.000 0.000 0.000  200.000 0.000 0.000 0.000  210.000 0.000 0.000 0.000  220.000 0.000 0.000 0.000  230.000 0.000 0.000 0.000  240.000 0.000 0.000 0.000  250.000 0.000 0.000 0.000
MAX_ACCELERATION  4 NAME "Tram"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 1.000 1.000 1.000  10.000 1.000 1.000 1.000  20.000 1.000 1.000 1.000  30.000 1.000 1.000 1.000  40.000 1.000 1.000 1.000  50.000 1.000 1.000 1.000  60.000 1.000 1.000 1.000  70.000 1.000 1.000 1.000  80.000 1.000 1.000 1.000  90.000 1.000 1.000 1.000  100.000 1.000 1.000 1.000  110.000 1.000 1.000 1.000  120.000 1.000 1.000 1.000  130.000 1.000 1.000 1.000  140.000 1.000 1.000 1.000  150.000 1.000 1.000 1.000  160.000 1.000 1.000 1.000  170.000 1.000 1.000 1.000  180.000 1.000 1.000 1.000  190.000 1.000 1.000 1.000  200.000 1.000 1.000 1.000  210.000 1.000 1.000 1.000  220.000 1.000 1.000 1.000  230.000 1.000 1.000 1.000  240.000 1.000 1.000 1.000  250.000 0.000 0.000 0.000
MAX_ACCELERATION  3 NAME "Bus"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 1.240 1.042 1.488  10.000 1.240 1.042 1.488  20.000 1.240 1.042 1.488  30.000 1.240 1.042 1.488  40.000 1.100 0.924 1.320  50.000 1.000 0.840 1.200  60.000 0.900 0.756 1.080  70.000 0.800 0.672 0.960  80.000 0.600 0.504 0.720  90.000 0.400 0.336 0.480  100.000 0.000 0.000 0.000  110.000 0.000 0.000 0.000  120.000 0.000 0.000 0.000  130.000 0.000 0.000 0.000  140.000 0.000 0.000 0.000  150.000 0.000 0.000 0.000  160.000 0.000 0.000 0.000  170.000 0.000 0.000 0.000  180.000 0.000 0.000 0.000  190.000 0.000 0.000 0.000  200.000 0.000 0.000 0.000  210.000 0.000 0.000 0.000  220.000 0.000 0.000 0.000  230.000 0.000 0.000 0.000  240.000 0.000 0.000 0.000  250.000 0.000 0.000 0.000
MAX_ACCELERATION  2 NAME "HGV"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 7.300 2.500 9.300  10.000 6.900 2.400 9.300  20.000 3.100 1.120 5.200  30.000 2.000 0.730 3.200  40.000 1.520 0.530 2.350  50.000 0.950 0.320 1.550  60.000 0.790 0.250 1.310  70.000 0.640 0.190 1.100  80.000 0.520 0.150 0.900  90.000 0.410 0.110 0.750  100.000 0.350 0.080 0.650  110.000 0.200 0.000 0.550  120.000 0.000 0.000 0.100  130.000 0.000 0.000 0.000  140.000 0.000 0.000 0.000  150.000 0.000 0.000 0.000  160.000 0.000 0.000 0.000  170.000 0.000 0.000 0.000  180.000 0.000 0.000 0.000  190.000 0.000 0.000 0.000  200.000 0.000 0.000 0.000  210.000 0.000 0.000 0.000  220.000 0.000 0.000 0.000  230.000 0.000 0.000 0.000  240.000 0.000 0.000 0.000  250.000 0.000 0.000 0.000
MAX_ACCELERATION  1 NAME "Car"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 3.500 1.960 3.500  10.000 3.200 1.493 3.500  20.000 2.786 1.300 3.500  30.000 2.468 1.152 3.500  40.000 2.200 1.027 3.500  50.000 1.964 0.917 3.273  60.000 1.751 0.817 2.918  70.000 1.554 0.725 2.590  80.000 1.372 0.640 2.286  90.000 1.200 0.560 2.000  100.000 1.038 0.484 1.730  110.000 0.969 0.452 1.614  120.000 0.899 0.420 1.499  130.000 0.830 0.387 1.384  140.000 0.761 0.355 1.268  150.000 0.692 0.323 1.153  160.000 0.623 0.291 1.038  170.000 0.553 0.258 0.922  180.000 0.484 0.226 0.807  190.000 0.415 0.194 0.692  200.000 0.346 0.161 0.577  210.000 0.277 0.129 0.461  220.000 0.208 0.097 0.346  230.000 0.138 0.065 0.231  240.000 0.069 0.032 0.115  250.000 0.000 0.000 0.000
DESIRED_ACCELERATION  6 NAME "Bike"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 3.500 1.960 3.500  10.000 3.200 1.493 3.500  20.000 2.786 1.300 3.500  30.000 2.468 1.152 3.500  40.000 2.200 1.027 3.500  50.000 1.964 0.917 3.273  60.000 1.751 0.817 2.918  70.000 1.554 0.725 2.590  80.000 1.372 0.640 2.286  90.000 1.200 0.560 2.000  100.000 1.038 0.484 1.730  110.000 0.969 0.452 1.614  120.000 0.899 0.420 1.499  130.000 0.830 0.387 1.384  140.000 0.761 0.355 1.268  150.000 0.692 0.323 1.153  160.000 0.623 0.291 1.038  170.000 0.553 0.258 0.922  180.000 0.484 0.226 0.807  190.000 0.415 0.194 0.692  200.000 0.346 0.161 0.577  210.000 0.277 0.129 0.461  220.000 0.208 0.097 0.346  230.000 0.138 0.065 0.231  240.000 0.069 0.032 0.115  250.000 0.000 0.000 0.000
DESIRED_ACCELERATION  5 NAME "Pedestrian"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 3.000 3.000 3.000  10.000 3.000 3.000 3.000  20.000 0.000 0.000 0.000  30.000 0.000 0.000 0.000  40.000 0.000 0.000 0.000  50.000 0.000 0.000 0.000  60.000 0.000 0.000 0.000  70.000 0.000 0.000 0.000  80.000 0.000 0.000 0.000  90.000 0.000 0.000 0.000  100.000 0.000 0.000 0.000  110.000 0.000 0.000 0.000  120.000 0.000 0.000 0.000  130.000 0.000 0.000 0.000  140.000 0.000 0.000 0.000  150.000 0.000 0.000 0.000  160.000 0.000 0.000 0.000  170.000 0.000 0.000 0.000  180.000 0.000 0.000 0.000  190.000 0.000 0.000 0.000  200.000 0.000 0.000 0.000  210.000 0.000 0.000 0.000  220.000 0.000 0.000 0.000  230.000 0.000 0.000 0.000  240.000 0.000 0.000 0.000  250.000 0.000 0.000 0.000
DESIRED_ACCELERATION  4 NAME "Tram"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 1.000 1.000 1.000  10.000 1.000 1.000 1.000  20.000 1.000 1.000 1.000  30.000 1.000 1.000 1.000  40.000 1.000 1.000 1.000  50.000 1.000 1.000 1.000  60.000 1.000 1.000 1.000  70.000 1.000 1.000 1.000  80.000 1.000 1.000 1.000  90.000 1.000 1.000 1.000  100.000 1.000 1.000 1.000  110.000 1.000 1.000 1.000  120.000 1.000 1.000 1.000  130.000 1.000 1.000 1.000  140.000 1.000 1.000 1.000  150.000 1.000 1.000 1.000  160.000 1.000 1.000 1.000  170.000 1.000 1.000 1.000  180.000 1.000 1.000 1.000  190.000 1.000 1.000 1.000  200.000 1.000 1.000 1.000  210.000 1.000 1.000 1.000  220.000 1.000 1.000 1.000  230.000 1.000 1.000 1.000  240.000 1.000 1.000 1.000  250.000 0.000 0.000 0.000
DESIRED_ACCELERATION  3 NAME "Bus"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 1.240 1.042 1.488  10.000 1.240 1.042 1.488  20.000 1.240 1.042 1.488  30.000 1.240 1.042 1.488  40.000 1.100 0.924 1.320  50.000 1.000 0.840 1.200  60.000 0.900 0.756 1.080  70.000 0.800 0.672 0.960  80.000 0.600 0.504 0.720  90.000 0.400 0.336 0.480  100.000 0.000 0.000 0.000  110.000 0.000 0.000 0.000  120.000 0.000 0.000 0.000  130.000 0.000 0.000 0.000  140.000 0.000 0.000 0.000  150.000 0.000 0.000 0.000  160.000 0.000 0.000 0.000  170.000 0.000 0.000 0.000  180.000 0.000 0.000 0.000  190.000 0.000 0.000 0.000  200.000 0.000 0.000 0.000  210.000 0.000 0.000 0.000  220.000 0.000 0.000 0.000  230.000 0.000 0.000 0.000  240.000 0.000 0.000 0.000  250.000 0.000 0.000 0.000
DESIRED_ACCELERATION  2 NAME "HGV"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 2.500 2.500 2.500  10.000 2.500 2.400 2.500  20.000 2.500 1.120 2.500  30.000 2.000 0.730 2.500  40.000 1.520 0.530 2.350  50.000 0.950 0.320 1.550  60.000 0.790 0.250 1.310  70.000 0.640 0.190 1.100  80.000 0.520 0.150 0.900  90.000 0.410 0.110 0.750  100.000 0.350 0.080 0.650  110.000 0.200 0.000 0.550  120.000 0.000 0.000 0.100  130.000 0.000 0.000 0.000  140.000 0.000 0.000 0.000  150.000 0.000 0.000 0.000  160.000 0.000 0.000 0.000  170.000 0.000 0.000 0.000  180.000 0.000 0.000 0.000  190.000 0.000 0.000 0.000  200.000 0.000 0.000 0.000  210.000 0.000 0.000 0.000  220.000 0.000 0.000 0.000  230.000 0.000 0.000 0.000  240.000 0.000 0.000 0.000  250.000 0.000 0.000 0.000
DESIRED_ACCELERATION  1 NAME "Car"    0.0 250.0   0.0   7.0
  BASE_POINT  0.000 3.500 1.960 3.500  10.000 3.200 1.493 3.500  20.000 2.786 1.300 3.500  30.000 2.468 1.152 3.500  40.000 2.200 1.027 3.500  50.000 1.964 0.917 3.273  60.000 1.751 0.817 2.918  70.000 1.554 0.725 2.590  80.000 1.372 0.640 2.286  90.000 1.200 0.560 2.000  100.000 1.038 0.484 1.730  110.000 0.969 0.452 1.614  120.000 0.899 0.420 1.499  130.000 0.830 0.387 1.384  140.000 0.761 0.355 1.268  150.000 0.692 0.323 1.153  160.000 0.623 0.291 1.038  170.000 0.553 0.258 0.922  180.000 0.484 0.226 0.807  190.000 0.415 0.194 0.692  200.000 0.346 0.161 0.577  210.000 0.277 0.129 0.461  220.000 0.208 0.097 0.346  230.000 0.138 0.065 0.231  240.000 0.069 0.032 0.115  250.000 0.000 0.000 0.000
MAX_DECELERATION  6 NAME "Bike"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -7.500 -8.500 -6.500  10.000 -7.400 -8.400 -6.400  20.000 -7.300 -8.300 -6.300  30.000 -7.200 -8.200 -6.200  40.000 -7.100 -8.100 -6.100  50.000 -7.000 -8.000 -6.000  60.000 -6.900 -7.900 -5.900  70.000 -6.800 -7.800 -5.800  80.000 -6.700 -7.700 -5.700  90.000 -6.600 -7.600 -5.600  100.000 -6.500 -7.500 -5.500  110.000 -6.400 -7.400 -5.400  120.000 -6.300 -7.300 -5.300  130.000 -6.200 -7.200 -5.200  140.000 -6.100 -7.100 -5.100  150.000 -6.000 -7.000 -5.000  160.000 -5.900 -6.900 -4.900  170.000 -5.800 -6.800 -4.800  180.000 -5.700 -6.700 -4.700  190.000 -5.600 -6.600 -4.600  200.000 -5.500 -6.500 -4.500  210.000 -5.400 -6.400 -4.400  220.000 -5.300 -6.300 -4.300  230.000 -5.200 -6.200 -4.200  240.000 -5.100 -6.100 -4.100
MAX_DECELERATION  5 NAME "Pedestrian"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -9.000 -9.500 -8.500  10.000 -9.000 -9.500 -8.500  20.000 -9.000 -9.500 -8.500  30.000 -9.000 -9.500 -8.500  40.000 -9.000 -9.500 -8.500  50.000 -9.000 -9.500 -8.500  60.000 -9.000 -9.500 -8.500  70.000 -9.000 -9.500 -8.500  80.000 -9.000 -9.500 -8.500  90.000 -9.000 -9.500 -8.500  100.000 -9.000 -9.500 -8.500  110.000 -9.000 -9.500 -8.500  120.000 -9.000 -9.500 -8.500  130.000 -9.000 -9.500 -8.500  140.000 -9.000 -9.500 -8.500  150.000 -9.000 -9.500 -8.500  160.000 -9.000 -9.500 -8.500  170.000 -9.000 -9.500 -8.500  180.000 -9.000 -9.500 -8.500  190.000 -9.000 -9.500 -8.500  200.000 -9.000 -9.500 -8.500  210.000 -9.000 -9.500 -8.500  220.000 -9.000 -9.500 -8.500  230.000 -9.000 -9.500 -8.500  240.000 -9.000 -9.500 -8.500
MAX_DECELERATION  4 NAME "Tram"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -5.000 -6.000 -4.000  10.000 -4.900 -5.900 -3.900  20.000 -4.800 -5.800 -3.800  30.000 -4.700 -5.700 -3.700  40.000 -4.600 -5.600 -3.600  50.000 -4.500 -5.500 -3.500  60.000 -4.400 -5.400 -3.400  70.000 -4.300 -5.300 -3.300  80.000 -4.200 -5.200 -3.200  90.000 -4.100 -5.100 -3.100  100.000 -4.000 -5.000 -3.000  110.000 -3.900 -4.900 -2.900  120.000 -3.800 -4.800 -2.800  130.000 -3.700 -4.700 -2.700  140.000 -3.600 -4.600 -2.600  150.000 -3.500 -4.500 -2.500  160.000 -3.400 -4.400 -2.400  170.000 -3.300 -4.300 -2.300  180.000 -3.200 -4.200 -2.200  190.000 -3.100 -4.100 -2.100  200.000 -3.000 -4.000 -2.000  210.000 -2.900 -3.900 -1.900  220.000 -2.800 -3.800 -1.800  230.000 -2.700 -3.700 -1.700  240.000 -2.600 -3.600 -1.600
MAX_DECELERATION  3 NAME "Bus"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -7.500 -8.500 -6.500  10.000 -7.400 -8.400 -6.400  20.000 -7.300 -8.300 -6.300  30.000 -7.200 -8.200 -6.200  40.000 -7.100 -8.100 -6.100  50.000 -7.000 -8.000 -6.000  60.000 -6.900 -7.900 -5.900  70.000 -6.800 -7.800 -5.800  80.000 -6.700 -7.700 -5.700  90.000 -6.600 -7.600 -5.600  100.000 -6.500 -7.500 -5.500  110.000 -6.400 -7.400 -5.400  120.000 -6.300 -7.300 -5.300  130.000 -6.200 -7.200 -5.200  140.000 -6.100 -7.100 -5.100  150.000 -6.000 -7.000 -5.000  160.000 -5.900 -6.900 -4.900  170.000 -5.800 -6.800 -4.800  180.000 -5.700 -6.700 -4.700  190.000 -5.600 -6.600 -4.600  200.000 -5.500 -6.500 -4.500  210.000 -5.400 -6.400 -4.400  220.000 -5.300 -6.300 -4.300  230.000 -5.200 -6.200 -4.200  240.000 -5.100 -6.100 -4.100
MAX_DECELERATION  2 NAME "HGV"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -5.500 -6.000 -5.000  10.000 -5.500 -6.000 -5.000  20.000 -5.500 -6.000 -5.000  30.000 -5.500 -6.000 -5.000  40.000 -5.500 -6.000 -5.000  50.000 -5.500 -6.000 -5.000  60.000 -5.500 -6.000 -5.000  70.000 -5.500 -6.000 -5.000  80.000 -5.500 -6.000 -5.000  90.000 -5.500 -6.000 -5.000  100.000 -5.500 -6.000 -5.000  110.000 -5.500 -6.000 -5.000  120.000 -5.500 -6.000 -5.000  130.000 -5.500 -6.000 -5.000  140.000 -5.500 -6.000 -5.000  150.000 -5.500 -6.000 -5.000  160.000 -5.500 -6.000 -5.000  170.000 -5.500 -6.000 -5.000  180.000 -5.500 -6.000 -5.000  190.000 -5.500 -6.000 -5.000  200.000 -5.500 -6.000 -5.000  210.000 -5.500 -6.000 -5.000  220.000 -5.500 -6.000 -5.000  230.000 -5.500 -6.000 -5.000  240.000 -5.500 -6.000 -5.000
MAX_DECELERATION  1 NAME "Car"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -7.500 -8.500 -6.500  10.000 -7.400 -8.400 -6.400  20.000 -7.300 -8.300 -6.300  30.000 -7.200 -8.200 -6.200  40.000 -7.100 -8.100 -6.100  50.000 -7.000 -8.000 -6.000  60.000 -6.900 -7.900 -5.900  70.000 -6.800 -7.800 -5.800  80.000 -6.700 -7.700 -5.700  90.000 -6.600 -7.600 -5.600  100.000 -6.500 -7.500 -5.500  110.000 -6.400 -7.400 -5.400  120.000 -6.300 -7.300 -5.300  130.000 -6.200 -7.200 -5.200  140.000 -6.100 -7.100 -5.100  150.000 -6.000 -7.000 -5.000  160.000 -5.900 -6.900 -4.900  170.000 -5.800 -6.800 -4.800  180.000 -5.700 -6.700 -4.700  190.000 -5.600 -6.600 -4.600  200.000 -5.500 -6.500 -4.500  210.000 -5.400 -6.400 -4.400  220.000 -5.300 -6.300 -4.300  230.000 -5.200 -6.200 -4.200  240.000 -5.100 -6.100 -4.100
DESIRED_DECELERATION  6 NAME "Bike"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -2.750 -3.000 -2.550  10.000 -2.750 -3.000 -2.550  20.000 -2.750 -3.000 -2.550  30.000 -2.750 -3.000 -2.550  40.000 -2.750 -3.000 -2.550  50.000 -2.750 -3.000 -2.550  60.000 -2.750 -3.000 -2.550  70.000 -2.750 -3.000 -2.550  80.000 -2.750 -3.000 -2.550  90.000 -2.750 -3.000 -2.550  100.000 -2.750 -3.000 -2.550  110.000 -2.750 -3.000 -2.550  120.000 -2.750 -3.000 -2.550  130.000 -2.750 -3.000 -2.550  140.000 -2.750 -3.000 -2.550  150.000 -2.750 -3.000 -2.550  160.000 -2.750 -3.000 -2.550  170.000 -2.750 -3.000 -2.550  180.000 -2.750 -3.000 -2.550  190.000 -2.750 -3.000 -2.550  200.000 -2.750 -3.000 -2.550  210.000 -2.750 -3.000 -2.550  220.000 -2.750 -3.000 -2.550  230.000 -2.750 -3.000 -2.550  240.000 -2.750 -3.000 -2.550
DESIRED_DECELERATION  5 NAME "Pedestrian"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -9.000 -9.500 -8.600  10.000 -9.000 -9.500 -8.600  20.000 -9.000 -9.500 -8.600  30.000 -9.000 -9.500 -8.600  40.000 -9.000 -9.500 -8.600  50.000 -9.000 -9.500 -8.600  60.000 -9.000 -9.500 -8.600  70.000 -9.000 -9.500 -8.600  80.000 -9.000 -9.500 -8.600  90.000 -9.000 -9.500 -8.600  100.000 -9.000 -9.500 -8.600  110.000 -9.000 -9.500 -8.600  120.000 -9.000 -9.500 -8.600  130.000 -9.000 -9.500 -8.600  140.000 -9.000 -9.500 -8.600  150.000 -9.000 -9.500 -8.600  160.000 -9.000 -9.500 -8.600  170.000 -9.000 -9.500 -8.600  180.000 -9.000 -9.500 -8.600  190.000 -9.000 -9.500 -8.600  200.000 -9.000 -9.500 -8.600  210.000 -9.000 -9.500 -8.600  220.000 -9.000 -9.500 -8.600  230.000 -9.000 -9.500 -8.600  240.000 -9.000 -9.500 -8.600
DESIRED_DECELERATION  4 NAME "Tram"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -0.850 -1.000 -0.730  10.000 -0.850 -1.000 -0.730  20.000 -0.850 -1.000 -0.730  30.000 -0.850 -1.000 -0.730  40.000 -0.850 -1.000 -0.730  50.000 -0.850 -1.000 -0.730  60.000 -0.850 -1.000 -0.730  70.000 -0.850 -1.000 -0.730  80.000 -0.850 -1.000 -0.730  90.000 -0.850 -1.000 -0.730  100.000 -0.850 -1.000 -0.730  110.000 -0.850 -1.000 -0.730  120.000 -0.850 -1.000 -0.730  130.000 -0.850 -1.000 -0.730  140.000 -0.850 -1.000 -0.730  150.000 -0.850 -1.000 -0.730  160.000 -0.850 -1.000 -0.730  170.000 -0.850 -1.000 -0.730  180.000 -0.850 -1.000 -0.730  190.000 -0.850 -1.000 -0.730  200.000 -0.850 -1.000 -0.730  210.000 -0.850 -1.000 -0.730  220.000 -0.850 -1.000 -0.730  230.000 -0.850 -1.000 -0.730  240.000 -0.850 -1.000 -0.730
DESIRED_DECELERATION  3 NAME "Bus"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -0.850 -1.000 -0.730  10.000 -0.850 -1.000 -0.730  20.000 -0.850 -1.000 -0.730  30.000 -0.850 -1.000 -0.730  40.000 -0.850 -1.000 -0.730  50.000 -0.850 -1.000 -0.730  60.000 -0.850 -1.000 -0.730  70.000 -0.850 -1.000 -0.730  80.000 -0.850 -1.000 -0.730  90.000 -0.850 -1.000 -0.730  100.000 -0.850 -1.000 -0.730  110.000 -0.850 -1.000 -0.730  120.000 -0.850 -1.000 -0.730  130.000 -0.850 -1.000 -0.730  140.000 -0.850 -1.000 -0.730  150.000 -0.850 -1.000 -0.730  160.000 -0.850 -1.000 -0.730  170.000 -0.850 -1.000 -0.730  180.000 -0.850 -1.000 -0.730  190.000 -0.850 -1.000 -0.730  200.000 -0.850 -1.000 -0.730  210.000 -0.850 -1.000 -0.730  220.000 -0.850 -1.000 -0.730  230.000 -0.850 -1.000 -0.730  240.000 -0.850 -1.000 -0.730
DESIRED_DECELERATION  2 NAME "HGV"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -1.250 -1.500 -1.050  10.000 -1.250 -1.500 -1.050  20.000 -1.250 -1.500 -1.050  30.000 -1.250 -1.500 -1.050  40.000 -1.250 -1.500 -1.050  50.000 -1.250 -1.500 -1.050  60.000 -1.250 -1.500 -1.050  70.000 -1.250 -1.500 -1.050  80.000 -1.250 -1.500 -1.050  90.000 -1.250 -1.500 -1.050  100.000 -1.250 -1.500 -1.050  110.000 -1.250 -1.500 -1.050  120.000 -1.250 -1.500 -1.050  130.000 -1.250 -1.500 -1.050  140.000 -1.250 -1.500 -1.050  150.000 -1.250 -1.500 -1.050  160.000 -1.250 -1.500 -1.050  170.000 -1.250 -1.500 -1.050  180.000 -1.250 -1.500 -1.050  190.000 -1.250 -1.500 -1.050  200.000 -1.250 -1.500 -1.050  210.000 -1.250 -1.500 -1.050  220.000 -1.250 -1.500 -1.050  230.000 -1.250 -1.500 -1.050  240.000 -1.250 -1.500 -1.050
DESIRED_DECELERATION  1 NAME "Car"    0.0 250.0 -10.0   0.0
  BASE_POINT  0.000 -2.750 -3.000 -2.550  10.000 -2.750 -3.000 -2.550  20.000 -2.750 -3.000 -2.550  30.000 -2.750 -3.000 -2.550  40.000 -2.750 -3.000 -2.550  50.000 -2.750 -3.000 -2.550  60.000 -2.750 -3.000 -2.550  70.000 -2.750 -3.000 -2.550  80.000 -2.750 -3.000 -2.550  90.000 -2.750 -3.000 -2.550  100.000 -2.750 -3.000 -2.550  110.000 -2.750 -3.000 -2.550  120.000 -2.750 -3.000 -2.550  130.000 -2.750 -3.000 -2.550  140.000 -2.750 -3.000 -2.550  150.000 -2.750 -3.000 -2.550  160.000 -2.750 -3.000 -2.550  170.000 -2.750 -3.000 -2.550  180.000 -2.750 -3.000 -2.550  190.000 -2.750 -3.000 -2.550  200.000 -2.750 -3.000 -2.550  210.000 -2.750 -3.000 -2.550  220.000 -2.750 -3.000 -2.550  230.000 -2.750 -3.000 -2.550  240.000 -2.750 -3.000 -2.550
KATTEMPERATURE  1 NAME ""    0.0 1080.0 -10.0 400.2
  BASE_POINT  0.000 -10.000 -10.000 -10.000  36.000 -4.500 -4.500 -4.500  72.000 1.000 1.000 1.000  108.000 6.500 6.500 6.500  144.000 12.000 12.000 12.000  180.000 17.500 17.500 17.500  216.000 23.000 23.000 23.000  252.000 50.000 50.000 50.000  288.000 53.000 53.000 53.000  324.000 56.000 56.000 56.000  360.000 79.000 79.000 79.000  396.000 121.600 121.600 121.600  432.000 175.000 175.000 175.000  468.000 233.000 233.000 233.000  504.000 291.000 291.000 291.000  540.000 342.400 342.400 342.400  576.000 347.760 347.760 347.760  612.000 353.120 353.120 353.120  648.000 358.480 358.480 358.480  684.000 363.840 363.840 363.840  720.000 369.200 369.200 369.200  756.000 374.560 374.560 374.560  792.000 379.920 379.920 379.920  828.000 385.280 385.280 385.280  864.000 390.640 390.640 390.640  900.000 396.000 396.000 396.000  925.200 400.200 400.200 400.200  1080.000 400.200 400.200 400.200
WATERTEMPERATURE  1 NAME ""    0.0 1080.0 -10.0  91.0
  BASE_POINT  0.000 -10.000 -10.000 -10.000  36.000 -5.600 -5.600 -5.600  72.000 -1.200 -1.200 -1.200  108.000 3.200 3.200 3.200  144.000 7.600 7.600 7.600  180.000 12.000 12.000 12.000  216.000 16.400 16.400 16.400  252.000 20.800 20.800 20.800  288.000 26.000 26.000 26.000  324.000 32.000 32.000 32.000  360.000 39.500 39.500 39.500  396.000 47.000 47.000 47.000  432.000 53.000 53.000 53.000  468.000 59.000 59.000 59.000  504.000 65.000 65.000 65.000  540.000 69.345 69.345 69.345  576.000 73.708 73.708 73.708  612.000 78.071 78.071 78.071  648.000 82.434 82.434 82.434  684.000 86.797 86.797 86.797  720.000 91.000 91.000 91.000  1080.000 91.000 91.000 91.000


-- Priority Rules: --
---------------------

PRIORITY_RULE ONLY_OWN_LINK NO


-- Stop Signs: --
-----------------


-- Conflict Areas: --
---------------------


-- Signal Controllers (SC): --
------------------------------



-- Detectors: --
----------------



-- Public Transport: --
-----------------------



-- Travel Times: --
-------------------

TRAVEL_TIME   AGGREGATION_INTERVAL 99999 FROM 0 UNTIL 99999 RAW NO  AGGREGATE YES


-- Delays: --
-------------



-- Data Collection: --
----------------------

CROSS_SEC_MEASUREMENT  FROM 0 UNTIL 99999  AGGREGATION_INTERVAL 99999
                     RAW NO  AGGREGATE NO VISUM_ONLINE NO
                     CONFIG_FILE ""



-- Queue Counters: --
---------------------



-- Data Collection Points: --
-----------------------------



-- Evaluations: --
------------------

EVALUATION  DATABASE "" CONFIRM_OVERWRITE  NO

EVALUATION  TYPE  CONVERGENCE  EDGE LENGTH 20.000
            TIME FROM 0.0 UNTIL 999999.0

WINDOW TYPE LDP SIGNAL_GROUP NUMBER DETECTOR NUMBER
                SCJ
WINDOW TYPE SZP SIGNAL_GROUP NUMBER DETECTOR NUMBER
                SCJ

-- Parking Lots: --
-------------------


-- Nodes: --
------------


-- Edge Closure: --
-------------------



-- TEAPAC: --
-------------


-- Emissions: --
----------------

EMISSION
        LAYERS ""
     AIR_DENSITY  1.202
     TEMPERATURE 20.000

-- Static 3D Models: --
-----------------------


-- Pavement Markers: --
-----------------------






-- Keyframes: --
----------------



-- 3D Traffic Signal Object Defaults: --
----------------------------------------

V3D_SIG_DEFAULTS_INIT
   DEF_ARM_ROTATION     90.000000
   DEF_USE_LIGHT     0
   DEF_STOP_BAR     0
   DEF_SIG_ROTATION     90.000000
   DEF_SIG_SPACING     -1.200000
   DEF_SIG_ARROWS_LIT     0

   DEF_SIG_LOD     600.000000 250.000000 150.000000 100.000000


V3D_SIGNAL_MASTS

   MAST_ID         0
   MAST_STYLE      0

   MAST_POS        0.000000 0.000000 0.000000
   MAST_HEIGHT     5.000000
   MAST_LENGTH     0.100000
   MAST_RADIUS     10.000000
   MAST_ROTATION   0.000000
   SIG_SCALE_FAC   1.000000


V3D_SIGNAL_MASTS_END


   V3D_SIGNAL_ARMS
      ARM_ID          0
      ARM_STYLE       0
      ARM_VISIBILITY  1
      ARM_POS         0.000000 0.000000 0.000000
      ARM_LENGTH      5.000000
      ARM_HEIGHT      4.800000
      ARM_ROTATION    0.000000
      SIG_SCALE_FAC   1.000000


   V3D_SIGNAL_ARMS_END

   V3D_SIGNAL_ARMS
      ARM_ID          0
      ARM_STYLE       7
      ARM_VISIBILITY  1
      ARM_POS         0.000000 0.000000 0.000000
      ARM_LENGTH      3.000000
      ARM_HEIGHT      3.000000
      ARM_ROTATION    0.000000
      SIG_SCALE_FAC   1.000000


   V3D_SIGNAL_ARMS_END

      V3D_SIGNAL_HEADS

         SIG_ID          0
         SIG_STYLE       0
         SIG_VISIBILITY  1
         SIG_TYPE        0
         SIG_ORIENTATION 0
         SIG_LAYOUT      11 0

         SIG_LSA_LEFT    -1
         SIG_LSA_RIGHT   -1
         SIG_LSA_THRU    -1
         SIG_GRP_LEFT    -1
         SIG_GRP_RIGHT   -1
         SIG_GRP_THRU    -1

         SIG_POS         0.000000 0.000000 0.210000
         SIG_HEIGHT      2.600000
         SIG_ROTATION    0.000000
         SIG_SCALE_FAC   0.550000


      V3D_SIGNAL_HEADS_END

V3D_SIG_DEFAULTS_END

-- 3D Traffic Signal Data: --
-----------------------------


-- Texture Lists: --
--------------------


-- Compass: --
--------------


-- 3D Settings: --
------------------
'''

LinkHead = '''
-- Links: --
------------
'''

class Link():
    def __init__( self, id ):
        '''id- int, link id
           length- float, meter, link length
        '''
        self.id = id
        self.length = -1  
        self.lanes = 1
        self.geometry = ''
    def setGeometry(self, points):
        '''points-[QgsPoint1, ..., QgsPoint10]
        '''
        ret = '\n  FROM  ' + str( points[0].x() ) + ' ' + str( points[0].y() )
        
        #calculate link length
        self.length = 0.
        for i in range(1, len(points) ):
            self.length += math.sqrt( ( points[i-1].x()-points[i].x() )**2 + ( points[i-1].y()-points[i].y() )**2 )
        
        #add vertexes
        for i in range(1, len(points)-1 ):
            if i%5 == 0:
                ret += '\n  OVER  %f %f 0.000  ' % (points[i].x(), points[i].y())
            else:
                ret += '  OVER  %f %f 0.000  ' % (points[i].x(), points[i].y())            
        ret += '\n  TO  ' + str( points[-1].x() ) + ' ' + str( points[-1].y() )
        self.geometry = ret
        
    def str(self):
        ''' return a link item for vissim file Link segment
        '''
        if self.length == -1: return ''
        
        str = 'LINK      %d  NAME "" LABEL  0.00 0.00' % self.id
        result = str
        str = '\n  TYPE      1 LENGTH %f LANES  %d LANE_WIDTH  3.50 GRADIENT 0.00000   COST 0.00000 SURCHARGE 0.00000 SURCHARGE 0.00000 SEGMENT LENGTH   10.000' % (self.length, self.lanes)
        result += str
        result += self.geometry
        result += '\n'
        return result    

class VissimFile():
    def __init__(self, path):
        self.path = path
        self.file = open( path, 'w' )
        self.links = []  #Link objects
        
    def save(self):
        self.file.write( Head )
        self.file.write( LinkHead )
        for link in self.links:
            self.file.write( link.str() )
        self.file.write( End )
        
    def appendLink(self, link):
        self.links.append( link )

#vf = VissimFile( 'd:/vissim.inp' )
#vf.save()
#print 'successful'

